#include "dwc_ddrphy_phyinit.h"
#include <stdlib.h>

void dwc_ddrphy_phyinit_userCustom_overrideUserInput () {
    char *printf_header;

    printf_header = " [dwc_ddrphy_phyinit_userCustom_overrideUserInput]";
    //dwc_ddrphy_phyinit_print ("\n");
    //dwc_ddrphy_phyinit_print ("\n");
    //dwc_ddrphy_phyinit_cmnt ("//##############################################################\n");
    //dwc_ddrphy_phyinit_cmnt ("\n");
    //dwc_ddrphy_phyinit_cmnt ("// dwc_ddrphy_phyinit_userCustom_overrideUserInput is a user-editable function.\n");
   // dwc_ddrphy_phyinit_cmnt ("//\n");
   // dwc_ddrphy_phyinit_cmnt ("// See PhyInit App Note for detailed description and function usage\n");
    //dwc_ddrphy_phyinit_print ("//\n");
    //dwc_ddrphy_phyinit_cmnt ("//##############################################################\n");
    dwc_ddrphy_phyinit_print ("\n");
    dwc_ddrphy_phyinit_print ("dwc_ddrphy_phyinit_userCustom_overrideUserInput ();\n");
    //dwc_ddrphy_phyinit_cmnt ("\n");

    // == Definitions for overriding a single PHY system 
    // Example Values for testing

    // === Example to override frequency for P-State 0,1,2,3
    // === using dwc_ddrphy_phyinit_setUserInput()
    dwc_ddrphy_phyinit_setUserInput ("Frequency[0]", 1600); // 3200Mbps 
    dwc_ddrphy_phyinit_setUserInput ("Frequency[1]", 1200); // 2400Mbps
    dwc_ddrphy_phyinit_setUserInput ("Frequency[2]", 933);  // 1866Mbps
    dwc_ddrphy_phyinit_setUserInput ("Frequency[3]", 50);   // 100Mbps
    
    
    // === Example to override MemAlert related inputs using dwc_ddrphy_phyinit_setUserInput()
    dwc_ddrphy_phyinit_setUserInput ("MemAlertEn", 0x1);
    dwc_ddrphy_phyinit_setUserInput ("MemAlertPUImp", 0x8);
    dwc_ddrphy_phyinit_setUserInput ("MemAlertVrefLevel", 32);
    dwc_ddrphy_phyinit_setUserInput ("MemAlertSyncBypass", 0x1);

    
    // === Example to override frequency by setting the data structure
    // === directly
    userInputBasic.Frequency[3]  = 1600;  // 3200Mbps 
    userInputBasic.Frequency[2]  = 1200;  // 2400Mbps
    userInputBasic.Frequency[1]  = 933;   // 1866Mbps
    userInputBasic.Frequency[0]  = 50;    // 100Mbps
    
    
    // === Example to override MemAlert related inputs by setting the data
    // === structure directly
    userInputAdvanced.MemAlertEn               = 0x0000;
    userInputAdvanced.MemAlertPUImp            = 0x0005;
    userInputAdvanced.MemAlertVrefLevel        = 0x0029;
    userInputAdvanced.MemAlertSyncBypass       = 0x0000;

    // === Example to set HdtCtrl to 0x8 for 1D for pstates 0,1,2,3
    // === using dwc_ddrphy_phyinit_setMb()
    dwc_ddrphy_phyinit_setMb (0, "HdtCtrl", 0x8, 0);
    dwc_ddrphy_phyinit_setMb (1, "HdtCtrl", 0x8, 0);
    dwc_ddrphy_phyinit_setMb (2, "HdtCtrl", 0x8, 0);
    dwc_ddrphy_phyinit_setMb (3, "HdtCtrl", 0x8, 0);

    dwc_ddrphy_phyinit_cmnt ("%s End of dwc_ddrphy_phyinit_userCustom_overrideUserInput()\n", printf_header);

}

